<?php
// 链接数据 库
$db = new PDO("mysql:host=127.0.0.1;dbname=school;charset=utf8","root","root");

$sql = "select * from stu";

// $res = $db->query($sql);

// $sql = "update stu set age=50 where sid<3";

$sql = "delete from  stu  where sid>7";

// $sql = "update stu set sex='女' where sname='小明'";

$res = $db->exec($sql);

if($res===false){
    exit("执行有误：".$db->errorInfo()[2]);
}

// $data = $res->fetchAll(PDO::FETCH_ASSOC);

var_dump($res);